<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4"
>
<head>
    <meta charset="UTF-8"/>
    <title>Thymeleaf in action</title>
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<!--<div th:replace="~{fragments/header::header}"></div>-->
<div>
    <h1> Thymeleaf in action</h1>
    <div sec:authorize="isAuthenticated()" class="row">
        <ul>
            <li>
                <span sec:authentication="name"></span>
            </li>
        </ul>
        <form action="/logout" th:action="@{/logout}" method="post">
            <input class="btn btn-outline-success" type="submit" value="退出">
        </form>
    </div>

    <div sec:authorize="isAnonymous()">
        <a href="/login" th:href="@{~/login}"> 111</a>
    </div>
    <a href="/users">首页</a>

    <div class="container">
        <form th:action="@{~/login}" method="post">
            <h2>请先登录</h2>
            <div>
                <label for="username" class="col-form-label">账号</label>
                <input type="text" class="form-control" id="username" name="username">
            </div>

            <div>
                <label for="password" class="col-form-label">密码</label>
                <input type="password" class="form-control" id="password" name="password">
            </div>

            <div>
                <div th:if="${loginError}">
                    <p th:text="${errorMsg}"></p>
            </div>
                <button type="submit">登录</button>>

        </form>
</div>

<div>
    <a href="http://www.baidu.com">百度一下</a>
</div>
</body>
</html>